package org.car.world.controller.shop;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.car.world.common.util.MyPlUtil;
import org.car.world.common.util.Page;
import org.car.world.core.entily.CommentsTable;
import org.car.world.core.entily.MerchantsTable;
import org.car.world.core.entily.OrderTable;
import org.car.world.service.CommentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author Administrator
 * @ClassName: HomeController
 * @Description:评论
 * @date Nov 22, 2018
 */
@Controller
@RequestMapping("shop")
public class CommentsController {

    @Autowired
    CommentsService commentsService;


    /**
     * @param @return 参数
     * @return String    返回类型
     * @throws
     * @Title: doindex_init
     * @Description: 访问商家的评论
     */
    @RequestMapping("pllist")
    @ResponseBody
    public Map<String, Object> UpBusinesspro(@RequestParam(value = "form", required = false, defaultValue = "1") Integer form,
                                             @RequestParam(value = "merid", required = false) Integer merid, Model mo) {

        Map<String, Object> hasmap = new HashMap<String, Object>();
        List<CommentsTable> CommentsList = new ArrayList<CommentsTable>();
        Page<CommentsTable> Page = new Page<CommentsTable>();
        Page.setCurrentPage(form);
        Page.setPageSize(10);
        Page.setTotalRow(commentsService.selectAllPlNum(merid));
        CommentsList = commentsService.selectAllMeridLimit(merid, Page.getCurrentPage(), Page.getPageSize());
        Page.setPageList(CommentsList);
        hasmap.put("Page", Page);
        hasmap.put("merid", merid);

        return hasmap;
    }


}
